// 汽车，struct
package structs

import "fmt"

type Bus struct {
	name string
}

func (b *Bus) SetName(busName string) error {
	if len(busName) > 10 {
		return SetNameError(busName)
	}

	b.name = busName
	return nil
}

func (b Bus) String() string {
	return fmt.Sprintf("i am a bus, name is %s", b.name)
}

func (b Bus) RunWithSpeed(speed float64) {
	fmt.Printf("i am a car, name is %s, run with speed %.2f\n", b.name, speed)
}
